#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
void solve()
{
    string s;
    getline(cin, s);
    string ans;

    ans += s[0];
    for (ll i = 1; i < s.size() - 1; i++)
    {
        if (s[i] == ' ')
        {
            ans += s[i + 1];
        }
    }

    cout << ans << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    getchar(); // consume the newline character after the integer input;
    while (t--)
    {
        solve();
    }
    return 0;
}
